<?php

/**
 * video filter form base class.
 *
 * @package    preuvideo
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasevideoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'tema_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tema'), 'add_empty' => true)),
      'youtube_id'        => new sfWidgetFormFilterInput(),
      'titulo'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'descripcion'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'puntaje'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cantidad_de_votos' => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'tema_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Tema'), 'column' => 'id')),
      'youtube_id'        => new sfValidatorPass(array('required' => false)),
      'titulo'            => new sfValidatorPass(array('required' => false)),
      'descripcion'       => new sfValidatorPass(array('required' => false)),
      'puntaje'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cantidad_de_votos' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('video_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'video';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'tema_id'           => 'ForeignKey',
      'youtube_id'        => 'Text',
      'titulo'            => 'Text',
      'descripcion'       => 'Text',
      'puntaje'           => 'Number',
      'cantidad_de_votos' => 'Number',
    );
  }
}
